#include "rename.h"

Rename::Rename()
{
}

void Rename::run(QString &dir, QStringList& orig, QStringList& newname, int offset, int operations)
{
    int errors=0;
    for(int i=offset; i<(offset+operations); i++)
    {   if(QString::compare(orig.at(i),newname.at(i))==0)
            continue;

        //char msg[1024];
        //sprintf(msg,"rename '%s' to '%s'",filesOrig.at(i).toAscii().data(),filesNew.at(i).toAscii().data());
        //QMessageBox::information(this,"rename",msg,QMessageBox::Ok);

        QString qsOld(dir+"\\"+orig.at(i));
        QString qsNew(dir+"\\"+newname.at(i));

        errors += rename(qsOld.toAscii().data(),qsNew.toAscii().data());
    }
    emit finished();
}
